#!/usr/bin/perl -w


use strict;


my @procs = `ps -ef|grep -v 'grep' | grep ConvCreator`;
my @controller = `ps -ef|grep -v 'grep' | grep StartDataLoad`;

push(@procs, @controller);

#print $procs;
my $pidList = '';

for(my $i=0; $i<scalar @procs; $i++){
    print $procs[$i]."\n";
    (my $user, my $pid, my $ppid, my $c, my $stime, my $tty, my $time, my $cmd) = split(' ',$procs[$i]);
    #print $user."\n";
    #print $pid."\n";

    $pidList = $pid." ".$pidList;
}

print $pidList."\n";
my $killCommand = 'sudo kill '.$pidList;

my $result = system($killCommand);
if($result ==-1){
    print "Error in killing the process\n";
}

